﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using MvcPresenter.Models.Validators;

namespace MvcPresenter.Models
{
	public enum DataState
	{
		NoChange,
		Inserting,
		Changed,
		Deleted
	}

	[PresentationValidator(ErrorMessage = "Markupが無いです")]
	public class Presentation
	{
		private readonly bool _isTemporary;
		public DataState State { get; set; }

		public Presentation() : this(true){}
		public Presentation(bool isTemporary)
		{
			State = DataState.NoChange;
			_isTemporary = isTemporary;

			Markups = new List<Markup>();
			StyleSheets = new List<ResourceFile>();
			Images = new List<ResourceFile>();
		}

		public bool IsTemporary
		{
			get
			{
				return _isTemporary;
			}
		}

		[Required]
		public string Name { get; set; }

		public IList<Markup> Markups{ get; set;}

		//[ListRequiresValidator(ErrorMessage = "Cssが含まれていません")]
        public IList<ResourceFile> StyleSheets { get; set; }

		//[ListRequiresValidator(ErrorMessage = "Imageが含まれていません")]
        public IList<ResourceFile> Images { get; set; }
	}
}